#!/bin/bash

# ailink 服务器开机自启rc.local文件

while true; do
		if ! curl -I http://10.219.86.140:8080 >/dev/null 2>&1; then
				ehco "acs is not running, wait 1 min..."
				sleep 60
				continue
	    fi
		
        if ! systemctl is-active --quiet libvirtd; then
                echo "libvirted service not running, wait 1 min..."
                sleep 60
                continue
        fi
		
        if ! systemctl is-active --quiet cloudstack-agent.service; then
                echo "cloudstack-agent service not running, wait 1 min..."
                sleep 60
                continue
        fi

        python3 /usr/local/bin/autostartvm.py --instanceId c2da3fbf-bd8e-429d-acae-1e00456776a1
        exit 0
done
